<%-- 
    Document   : list
    Created on : 6-dec-2009, 15:24:14
    Author     : Simon
--%>

<%-- ${pageContext.request.contextPath} --%>
<%@include file="../../header.jsp" %>

<h1>Prescriptions for ${patientname}</h1>

<c:if test="${!empty flash}">
    <div class="flash notice">${flash}</div>
</c:if>

<c:choose>
    <c:when test="${empty prescriptions}">
        No prescriptions found.
    </c:when>
    <c:otherwise>
        <table class="data">
            <thead>
            <tr>
                <td>Medication</td>
                <td>Dosage</td>
                <td>Frequency</td>
                <td>Start</td>
                <td>End</td>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="prescription" items="${prescriptions}" varStatus="index">
                <tr>
                    <td>${prescription.medication.name}</td>
                    <td>
                        <c:if test="${prescription.dosageIsFixed}">
                            ${prescription.dosageDosage} ${prescription.dosageUnit}
                        </c:if>
                        <c:if test="${!prescription.dosageIsFixed}">
                            Variable
                        </c:if>
                    </td>
                    <td>${prescription.frequency}</td>
                    <td>
                        <fmt:formatDate value="${prescription.startTime}" pattern="d MMM yyyy HH:00" />
                    </td>
                    <td>
                        <fmt:formatDate value="${prescription.endTime}" pattern="d MMM yyyy HH:00" />
                    </td>
                    <td>
                        <a href="${pageContext.request.contextPath}/gp/patient/prescription/details?id=${prescription.prescriptionId}">View details</a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </c:otherwise>
</c:choose>


<%@include file="../../footer.jsp" %>
